%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Eigenstates of a potential, DGl routine.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function d_Y = LiRbStates(R,Y,flag,Ej,lvl)

	Constant;
	fctr=2*2*uA/(1/6+1/87)/mE;

	d_Y=[fctr*(LiRbStates_Pot(R,lvl)-Ej)*Y(2) ; Y(1)];
end


function [V,Vmorse,Vlngrng] = LiRbStates_Pot(R,lvl)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LiRb potentials, adapts the potential in atomic units.

	Constant;
	cnst=e0^2/4/pi/E0/aB/2/pi/hP/100/c0;													%conversion a.u. to cm^-1

	[Rm,Dm,Bm,Rt,C6,C8,C10]=LiRbStates_Par(R,lvl);										%gets van der Waals parameters

	Vmorse=Dm/cnst*((1-exp(-(R-Rm)/Bm)).^2-1);											%Morse part of the potential in a.u.

	Vlngrng=-(C6./R.^6)-(C8./R.^8)-(C10./R.^10);											%long range part of the potential in a.u.

	F=exp(-(R/Rt).^10);																		%join potentials
	V=Vmorse.*F + Vlngrng.*(1-F);
end

function [Rm,Dm,Bm,Rt,C6,C8,C10] = LiRbStates_Par(R,lvl)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LiRb potentials, gets van der Waals parameters,
%  Rm : center of exchange potential			in aB
%  Dm : potential depth							in 1/cm
%  Bm : width of exchange potential			in aB
%  Rt : short-to-long range connection point	in aB
%  C6 : van der Waals coefficient				in aB^6 
%  Te : potential depth							in 1/cm
%  Re : location of potential minimum			in Angs
%  we :											in 1/cm
%  Be : rotational constant						in 1/cm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if     sum(lvl(1:6)=='(1)1Si')==6 wch=1;
elseif sum(lvl(1:6)=='(2)1Si')==6 wch=2;
elseif sum(lvl(1:6)=='(3)1Si')==6 wch=3;
elseif sum(lvl(1:6)=='(1)3Si')==6 wch=4;
elseif sum(lvl(1:6)=='(2)3Si')==6 wch=5;
elseif sum(lvl(1:6)=='(3)3Si')==6 wch=6;
elseif sum(lvl(1:6)=='(1)1Pi')==6 wch=7;
elseif sum(lvl(1:6)=='(2)1Pi')==6 wch=8;
elseif sum(lvl(1:6)=='(1)3Pi')==6 wch=9;
elseif sum(lvl(1:6)=='(2)3Pi')==6 wch=10;
end

Pa=[																														%[Korek00 & Marinescu99]]
%Rm		Dm		Bm		Rt		C6			C8			C10			Te		Re		we		Be
6.4		4700	2.3		9.6		2545		2.34e5		2.61e7		0		3.43	194.0	.220		%(1)1Sigma+	X	%[Derevianko01 & 03]
7.84	7087	4.02	16.0	2.6744e4	2.8089e6	0			11639	4.138	119.6	.152		%(2)1Sigma+	A	
7.9    3490	3.0    15.8	-1.6506e4	1.8187e6	0			17438	4.257	113.0	.144		%(3)1Sigma+	C
9.65	279		2.5		20		3015		7.6e5		7e7			5678	5.126	41.2	.100		%(1)3Sigma+	a
7.64	3941	2.94	24.1	2.6744e4	2.8089e6	0			14719	4.064	129.9	.157		%(2)3Sigma+	c
7.35	370		1.0		16.6	-1.6506e4	1.8187e6	0			0		0		0		0			%(3)3Sigma+
7.35	1429	2.13	13.7	9.4312e3	1.7135e5	0			17205	3.813	140.5	.179		%(1)1Pi		B
7.8    1481	2.4		10.9	-2.5677e3	4.1208e5	0			19201	4.101	141.7	.155		%(2)1Pi		D
6.14	8426	2.63	11.7	9.4312e3	1.7135e5	0			10233	3.348	191.7	.232		%(1)3Pi		b
7.74	1383	2.30	13.6	-2.5677e3	4.1208e5	0			19484	4.115	39.4	.160		%(2)3Pi
];

Rm=Pa(wch,1);																							%in aB
Dm=Pa(wch,2);																							%in a.u.
Bm=Pa(wch,3);																							%in 1/aB
Rt=Pa(wch,4);																							%in 1/aB
C6 =Pa(wch,5);																						%in aB^6
C8 =Pa(wch,6);																						%in aB^8
	C10=Pa(wch,7);																						%in aB^10

	Po=[																														%[Marinescu97]
%C5			C6			C8			C10
	0			2.7415e4	8.6940e6	3.4006e9															%2S-6S 1,3Sigma+
	0			1.1736e5	8.6022e6	2.5892e9															%3S-5S 1,3Sigma+
	0			1.5217e4	5.8713e6	0 																	%2S-4D	1,3Sigma+
	0			1.3195e4	1.5770e6	0																	%2S-4D	1,3Pi	
	0			7.1308e3	-1.5547e5	0																	%2S-4D	1,3Delta
	0			2.6838e4	3.2636e7	0																	%3D-5S	1,3Sigma+
	0			2.4318e4	1.2976e7	0																	%3D-5S	1,3Pi	
	0			1.6758e4	6.8198e5	0																	%3D-5S	1,3Delta
	-3.8417e2	6.5618e3	-1.8430e6	0																	%2P-5P	1,3Delta
	1.5367e3	6.1659e3	1.7324e6	0																	%2P-5P	1,3Pi
	0			1.1244e4	-2.5382e6	0																	%2P-5P	1,3Pi
	0			4.0227e3	-2.3540e4	0																	%2P-5P	1,3Sigma-
	0			1.0107e4	-3.4418e6	0																	%2P-5P	1,3Sigma+
	-2.3050e3	-9.0214e4	3.9927e6	0																	%2P-5P	1,3Sigma+
	];
end
